package com.fh.service.ccode;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.fh.dao.DaoSupport;
import com.fh.util.PageData;

// 固定
@Service("talentsService")
public class TalentsService {
	
	@Resource(name ="daoSupport")
	private DaoSupport dao;

	@SuppressWarnings("unchecked")
	public List<PageData> getTalentsList(PageData pd) throws Exception {
		return (List<PageData>) dao.findForList("TalentsMapper.getTalentsList", pd);
	}
	
	@SuppressWarnings("unchecked")
	public List<PageData> getTalentsListForEnterprise(PageData pd) throws Exception {
		return (List<PageData>) dao.findForList("TalentsMapper.getTalentsListForEnterprise", pd);
	}

	public PageData getInfoByID(PageData pd) throws Exception{
		return (PageData) dao.findForObject("TalentsMapper.getInfoByID", pd);
	}

	@SuppressWarnings("unchecked")
	public List<PageData> getOneSolutionList(PageData pd) throws Exception{
		return (List<PageData>) dao.findForList("TalentsMapper.getOneSolutionList", pd);
	}

	@SuppressWarnings("unchecked")
	public List<PageData> getTaComments(PageData pd) throws Exception{
		return (List<PageData>) dao.findForList("TalentsMapper.getTaComments", pd);
	}

	public void addTaComment(PageData pd) throws Exception{
		dao.save("TalentsMapper.saveTaComments", pd);
	}

	public void modifyInfo(PageData pd) throws Exception{
		dao.update("TalentsMapper.modifyInfo", pd);
	}

	public void modifyImg(PageData pd) throws Exception{
		dao.update("TalentsMapper.modifyImg", pd);
	}

	public void addCodeTime(PageData pd) throws Exception{
		dao.save("TalentsMapper.saveCodeTime", pd);
	}

	@SuppressWarnings("unchecked")
	public List<PageData> getTopFiveLand(PageData pd) throws Exception{
		return (List<PageData>) dao.findForList("TalentsMapper.getTopFiveLang", pd);
	}
	
	@SuppressWarnings("unchecked")
	public List<PageData> getTopFiveIDE(PageData pd) throws Exception{
		return (List<PageData>) dao.findForList("TalentsMapper.getTopFiveIDE", pd);
	}
	
	@SuppressWarnings("unchecked")
	public List<PageData> getLastFiveDaysTime(PageData pd) throws Exception{
		return (List<PageData>) dao.findForList("TalentsMapper.getLastFiveDays", pd);
	}
	
	@SuppressWarnings("unchecked")
	public List<PageData> getAllDaysTime(PageData pd) throws Exception{
		return (List<PageData>) dao.findForList("TalentsMapper.getAllDays", pd);
	}
	
	public Long checkPermission(PageData pd) throws Exception{
		PageData ret = (PageData) dao.findForObject("TalentsMapper.checkPermission", pd);
		return (Long) ret.get("PERMISSION");
	}
}
